import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import News from '@/views/News'
import House from '@/views/House'
import My from '@/views/My'
import Login from '@/views/Login'
import City from '@/views/city'
import Map from '@/views/map'
import Registered from '@/views/registered'
import Favorate from '@/views/favorate'
import Add from '@/views/Add'
import Search from '@/views/Search'
import Detail from '@/views/Detail'
import Rent from '@/views/Rent'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout'
  },
  {
    path: '/layout',
    component: Layout,
    redirect: '/layout/home',
    children: [
      {
        path: '/layout/home',
        component: Home
      },
      {
        path: '/layout/news',
        component: News
      },
      {
        path: '/layout/house',
        component: House
      },
      {
        path: '/layout/my',
        component: My
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/city',
    component: City
  },
  {
    path: '/map',
    component: Map
  },
  {
    path: '/registered',
    component: Registered
  },
  {
    path: '/favorate',
    component: Favorate
  },
  {
    path: '/add',
    component: Add
  },
  {
    path: '/search',
    component: Search
  },
  {
    path: '/detail/:id',
    component: Detail,
    props: true
  },
  {
    path: '/rent',
    component: Rent
  }
]

const router = new VueRouter({
  routes
})

export default router
